package BinaryTree;

import java.util.List;
import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        MyBinaryTree myBinaryTree = new MyBinaryTree();
        MyBinaryTree.TreeNode s1 = myBinaryTree.createTree();
        boolean p = myBinaryTree.isCompleteTree(s1);
        System.out.println(p);
    }

    public static void main9(String[] args) {
        MyBinaryTree myBinaryTree = new MyBinaryTree();
        MyBinaryTree.TreeNode s1 = myBinaryTree.createTree();
        List<Character> p1 = myBinaryTree.LevelTraversal(s1);
        List<List<Character>> p2 = myBinaryTree.LevelTraversal1(s1);
        System.out.println(p1);
        System.out.println(p2);
    }

    public static void main8(String[] args) {
        MyBinaryTree myBinaryTree = new MyBinaryTree();
        Scanner in = new Scanner(System.in);
        String str1 = "abc##de#g##f###";
        while (in.hasNextLine()) {
            String str = in.nextLine();
            MyBinaryTree.TreeNode root = myBinaryTree.CreateTree(str);
            myBinaryTree.PreTraversal(root);
        }
    }

    public static void main7(String[] args) {
        MyBinaryTree myBinaryTree = new MyBinaryTree();
        MyBinaryTree.TreeNode p1 = myBinaryTree.createTree();
        boolean s1 = myBinaryTree.isBalanced(p1);
        System.out.println(s1);
    }

    public static void main6(String[] args) {
        MyBinaryTree myBinaryTree = new MyBinaryTree();
        MyBinaryTree.TreeNode p1 = myBinaryTree.createTree();
        MyBinaryTree.TreeNode root = myBinaryTree.invertTree(p1);
        myBinaryTree.PreTraversal(root);
    }

    public static void main5(String[] args) {
        MyBinaryTree myBinaryTree = new MyBinaryTree();
        MyBinaryTree.TreeNode A = myBinaryTree.createTree();
        MyBinaryTree.TreeNode s1 = myBinaryTree.find(A, 'C');
        System.out.println(s1.val);
    }

    public static void main4(String[] args) {
        MyBinaryTree myBinaryTree = new MyBinaryTree();
        MyBinaryTree.TreeNode p1 = myBinaryTree.createTree();
        MyBinaryTree.TreeNode p2 = myBinaryTree.createTree1();
        boolean s1 = myBinaryTree.SameTree(p1, p2);
        System.out.println(s1);
    }

    public static void main3(String[] args) {
        MyBinaryTree myBinaryTree = new MyBinaryTree();
        MyBinaryTree.TreeNode A = myBinaryTree.createTree();
        int size = myBinaryTree.GetkTreeNode(A, 3);
        int high = myBinaryTree.GetHeight(A);
        //System.out.println(size);
        System.out.println(high);
    }

    public static void main2(String[] args) {
        MyBinaryTree myBinaryTree = new MyBinaryTree();
        MyBinaryTree.TreeNode A = myBinaryTree.createTree();
        myBinaryTree.leafTreeNode(A);
        //System.out.println(myBinaryTree.size);
        int size = myBinaryTree.leafTreeNode1(A);
        int size1 = myBinaryTree.AllTreeNode(A);
        System.out.print("叶子结点的个数：" + size);
        System.out.println();
        System.out.print("结点的个数：" + size1);
    }

    public static void main1(String[] args) {
        MyBinaryTree myBinaryTree = new MyBinaryTree();
        MyBinaryTree.TreeNode A = myBinaryTree.createTree();
        myBinaryTree.PreTraversal(A);
        System.out.println();
        myBinaryTree.MidTraversal(A);
        System.out.println();
        myBinaryTree.LastTraversal(A);
    }
}
